package com.llse.actions;

import com.intellij.ide.actions.CreateFileAction;
import com.intellij.ide.actions.CreateFileFromTemplateAction;
import com.intellij.ide.actions.CreateFileFromTemplateDialog;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsActions;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.psi.PsiDirectory;
import com.llse.lang.LLseIcons;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;

public class CreateNewLLseFileAction extends CreateFileFromTemplateAction {


    private static final String CREATE_LLSE_FILE = "New LLSE Plugins";
    private static final String FILE_TEMPLATE = "New LLSE Plugins";
    private static final String FILE_KIND = "Source File";

    private static final Icon File_Icon = LLseIcons.FILE;

    public CreateNewLLseFileAction() {//右键菜单New时触发的action，继承了 CreateFileFromTemplateAction
        super(CREATE_LLSE_FILE,"",File_Icon);
    }

    @java.lang.Override
    protected void buildDialog(@NotNull Project project, @NotNull PsiDirectory psiDirectory, CreateFileFromTemplateDialog.@NotNull Builder builder) {
        builder.setTitle(CREATE_LLSE_FILE)
                .addKind(FILE_KIND,File_Icon,FILE_TEMPLATE);
    }

    @java.lang.Override
    protected java.lang.@NlsContexts.Command String getActionName(PsiDirectory psiDirectory, java.lang.@NonNls @NotNull String s, java.lang.@NonNls String s1) {
        return CREATE_LLSE_FILE;
    }
}
